package pure.engine.core 
{
	
	/**
	 * 进程对象
	 * 
	 * [Author] - PURE
	 */
final internal class ProcessObject 
{

	/**
	 * 获取
	 */
	internal static function getProcessObject():ProcessObject
	{
		if (numProcess > 0)
		{
			numProcess--
			return cachedProcessObjects.pop();
		}
		return new ProcessObject();
	}
	
	
	/**
	 * 回收
	 */
	internal function recycle():void
	{
		listener = null;
		next = prev = null;
		cachedProcessObjects[numProcess++] = this;
		enqueued = false;
	}
	
	

	
	//======================
	// Member
	//======================
	
	
	internal static var cachedProcessObjects:Vector.<ProcessObject> = new Vector.<ProcessObject>();
	
	internal static var numProcess:int;
	
    internal var listener:IProcessListener;  // 进程侦听器
	
    internal var priority:int;  // 优先级
	
	internal var prev:ProcessObject, next:ProcessObject;

	internal var enqueued:Boolean;  // 已入队
	
}

}